import java.util.Scanner;

public class OutMoney {
    public static Scanner scanf = new Scanner(System.in);

    public double outMoney(double money) {
        if(money==0){
            System.out.println("当前存款为零，无法取款");
            return money;
        }

        System.out.println("请输入要取款的金额,输入0则退出：");
        while(scanf.hasNextDouble()){
            Double outMoney = scanf.nextDouble();
            if (outMoney==0){
                break;
            }
            scanf.nextLine();
            if (outMoney < money) {
                money -= outMoney;
                System.out.println("ATM正在吐出现钞，请取走...");
            } else {
                System.out.println("余额不足");
            }
            System.out.println("请输入要取款的金额,输入0则退出：");
//            return money;
        }
        System.out.println("当前即将返回主页...");
        return money;
    }
}
